System for background subtraction with 3D camera

ABSTRACT

A system for background image subtraction includes a computing device coupled with a 3D video camera, a processor o£ the device programmed to receive a video feed from the camera containing images of one or more subject that include depth information. The processor, for an image: segments pixels and corresponding depth information into three different regions including foreground (FG), background (BG), and unclear (UC); categorizes UC pixels as FG or BG using a function that considers the color and background history (BGH) information associated with the UC pixels and the color and BGH information associated with pixels near the UC pixels; examines the pixels marked as FG and applies temporal and spatial filters to smooth boundaries of the FG regions; constructs a new image by overlaying the FG regions on top of a new background; displays a video feed of the new image in a display device; and continually maintains the BGH.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No.14/805,335, filed Jul. 21, 2015, entitled “SYSTEM FOR BACKGROUNDSUBTRACTION WITH 3D CAMERA”, which is a continuation of U.S. applicationSer. No. 14/174,498, filed Feb. 6, 2014, entitled “SYSTEM FOR BACKGROUNDSUBTRACTION WITH 3D CAMERA”, now U.S. Pat. No. 9,087,229, which is acontinuation of U.S. application Ser. No. 12/871,428, filed Aug. 30,2010, entitled “SYSTEM FOR BACKGROUND SUBTRACTION WITH 3D CAMERA”, nowU.S. Pat. No. 8,649,592.

TECHNICAL FIELD

The present disclosure relates generally to 3D image processing, andmore particularly, to a system for background subtraction from images ina video stream using a three-dimensional camera.

BACKGROUND

Background subtraction (BGS) refers to the ability to remove unwantedbackground from a live video. Some current video conferencing programsuse BGS technology to subtract and replace the background with anotherprerecorded still or moving background.

There have been several methods developed for BGS using colorinformation only. These methods are either not robust for challenging,but common, situations such as a moving background and changinglighting, or too computationally expensive to be able to run inreal-time. The recent emergency of depth cameras provides an opportunityto develop robust, real-time BGS systems using depth information.However, due to current hardware limitations, some of which arefundamental, recorded depth video has poor quality. Notable problemswith recorded depth are noisy and instable depth values around objectboundaries, and the loss of depth values in hair of a person or shinyobject areas, such as belt buckles. As a result, background removal by asimple depth thresholding-referred to as Basic BGS herein-inherits a lotof annoying visual artifacts. Ideally, a robust system will detect andeliminate visual artifacts, and reduce jitter and roughness around edgescontiguous with a removed background.

BRIEF DESCRIPTION OF THE DRAWINGS

A more particular description of the disclosure briefly described abovewill be rendered by reference to the appended drawings. Understandingthat these drawings only provide information concerning typicalembodiments and are not therefore to be considered limiting of itsscope, the disclosure will be described and explained with additionalspecificity and detail through the use of the accompanying drawings.

FIG. 1 is a block diagram of an embodiment of a system including athree-dimensional (3D) camera, for subtraction of a background from avideo image.

FIG. 2 is a block diagram including a flow chart showing the details ofsteps executed by the background subtraction module of the system ofFIG. 1, to subtract a background from a video image.

FIG. 3 is a screen shot of a captured video image showing input depthinformation of the video image.

FIG. 4 is a screen shot of the input infrared (IR) intensity of thevideo image captured in FIG. 3.

FIG. 5 is a screen shot of the input red/green/blue (RGB) colorinformation of the video image captured in FIG. 3.

FIG. 6 is a region map of the video image captured in FIG. 3, theregions displayed including unclear (UC) in light grey, foreground (FG)in dark grey, and background (BG) in black, which are generated in block202 of FIG. 2.

FIG. 7 is a screen shot of the region map of FIG. 6 after execution ofblock 204 of FIG. 2 to detect and clean certain UC and FG 3D-connectedcomponents.

FIG. 8 is a screen shot of the region map of FIG. 7 showing center ofmass (COM) lines on both the sitting (or near) subject and the standing(or far) subject.

FIG. 9 is a screen shot of the region map of FIG. 8 after execution ofblock 208 in FIG. 2 to clean the UC region under the COM.

FIG. 10 is a diagram showing that a point X in the 3D space of acaptured video image can be warped from the reference image plane (depthsensor viewpoint) to the desired image plane (color sensor viewpoint) asexecuted in block 210 of FIG. 2.

FIG. 11 is a screen shot of a warped FG region of a video image of asubject after execution of the warping in FIG. 10.

FIG. 12 is a screen shot of a warped UC region corresponding to thevideo image of FIG. 11.

FIG. 13 is a screen shot of the UC region shown in FIG. 12 afterexecution of block 212 in FIG. 2 to clean the UC region with backgroundhistory (BGH) of corresponding UC region pixels.

FIG. 14 is a screen shot of the FG region of the video imagecorresponding to FIGS. 11-13 after execution of block 214 to interpolatethe FG region.

FIG. 15 is a screen shot of the UC region of the video imagecorresponding to FIGS. 11-13 after execution of block 214 to interpolatethe region map.

FIG. 16 is a screen shot of the UC region of the video image in FIG. 15after execution of block 216 of FIG. 2 to dilate the remaining UCregion.

FIG. 17 is a screen shot of the UC region of FIG. 16 after execution ofblock 218 in FIG. 2 to detect a FG fringe and merge it into the currentUC region.

FIG. 18 is a screen shot of the BG region of the video image of FIG. 17after execution of block 220 to update the BGH based on the BG regionand any unknown pixels.

FIG. 19 is a screen shot of the UC region of the video image of FIG. 18before execution of block 222 of FIG. 2 to clean the UC region usingneighbor pixels.

FIG. 20 is a screen shot of the UC region of the video image of FIG. 19after execution of block 222 of FIG. 2 to clean the UC region usingneighbor pixels.

FIG. 21 is a screen shot of the UC region of the video image of FIG. 20after execution of block 224 to clean the UC region under the COM of thesubject.

FIG. 22 is a screen shot of the FG region of the video image of FIG. 21before execution of block 226 of FIG. 2 to apply a median filter to theUC region and merge the remaining UC region with the FG region.

FIG. 23 is a screen shot of the FG region of the video image of FIG. 21after execution of block 226 of FIG. 2 to apply the median filter to theUC region and merge the remaining UC region with the FG region.

FIG. 24 is a screen shot of the region map of the video image of FIG. 23after execution of block 228 to stabilize and smooth FG images byreducing flickering and blurring.

FIG. 25 is a screen shot of an example video image before execution ofthe background subtraction module of FIG. 2.

FIG. 26 is a screen shot of the video image of FIG. 25 after executionof the background subtraction module of FIG. 2.

FIG. 27 is a screen shot of another example video image before executionof the background subtraction module of FIG. 2.

FIG. 28 is a screen shot of the video image of FIG. 27 after executionof the background subtraction module of FIG. 2.

FIG. 29 illustrates a general computer system, which may represent anyof the computing devices referenced herein.

DETAILED DESCRIPTION

By way of introduction, the present disclosure relates to a systemhaving a computing device (or other computer) coupled with athree-dimensional (3D) camera for subtracting a background (BG) from avideo feed. The system may also replace the removed background with anew background, whether a still or video image. The system executesvarious, or all, of the steps executable by a background subtractionmodule disclosed herein to achieve step-by-step improvement in arobustness and quality of the result. That is, the module as executed bya processor eliminates the artifacts, noise, and the instability of thedepth information around edges of one or more target person—alsoreferred to as subject herein—that is to remains as foreground (FG) whenthe background is subtracted.

The system receives a video feed from the 3D camera that containscolored images of the one or more subject that includes depthinformation. For each colored image extracted from the video feed, thesystem segments colored pixels and corresponding depth information ofthe images into three different regions including foreground (FG),background (BG), and unclear (UC). The system may then categorize UCpixels as FG or BG using a function that considers the color andbackground history (BGH) information associated with the UC pixels andthe color and BGH information associated with pixels near the UC pixels.Pixels that are near other pixels may also be referred to herein asneighbor pixels, which are pixels within a predetermined-sized windowthat includes the pixel of reference.

The system may also examine the pixels marked as FG and apply temporaland spatial filters to smooth boundaries of the FG regions. The systemmay then construct a new image by overlaying the FG regions on top of anew background, and display a video feed of the new image in a displaydevice coupled with the computing device. The new background may includestill images or video. The FG region that remains preferably includesone or more target subjects that are to be transferred from theprocessed image to the new image. The system may also continuallymaintain the BGH to keep it up to date for continued processing acrossmultiple images within a video stream. Additional or different steps arecontemplated and explained with reference to the Figures herein.

FIG. 1 is a block diagram of an embodiment of a system 100 including acomputing device (or other computer) 101 coupled with a 3D camera 103,for subtraction of a background (BG) from a video feed having a seriesof images. Herein, the phrase “coupled with” is defined to mean directlyconnected to or indirectly connected through one or more intermediatecomponents. Such intermediate components may include both hardware andsoftware based components, including a network 107 over which users 109may access the computing device 101.

The 3D camera 103 includes, among other components, a red/green/blue(RGB) sensor 113, an infrared (IR) sensor 115, and an IR illuminator117. The IR illuminator 117 shines light through a lens of the camera103 and the infrared sensor 115 receives the depth information of thereflected light, giving definition to objects within view or in the“scene” of the camera 103. The RGB sensor 113 captures the colored pixelinformation in the scene of the captured video image. The 3D camera 103may also include synchronization hardware and/or software 119 embeddedtherein to temporally synchronize the IR illuminator 117, the IR sensor115, and the RGB sensor 113 together. The 3D camera 103 may also includea 3D application programming interface (API) 121, which may beprogrammed to receive the depth information (Z) 123, the brightness (B)125, and RGB pixel 127 information of a reflected video image ascaptured by the 3D camera 103. The 3D API 121 provides the IO structureand interface programming required to pass this information 123, 125,and 127 to the computer or computing device 101.

The computing device 101 may further include, or be coupled with, abackground subtraction module 129 stored in memory and executable by aprocessor, a post-processing module 131, background subtractionapplication programming interface (API) 133, a background history (BGH)storage 135 part of memory, and a display 139 such as a computerscreen/monitor or a plasma or LCD screen of a television or smartdevice. Accordingly, the computing device 101 may include a desktop,laptop, smart phone, or other mobile or stationary computing devicehaving sufficient processing power to execute the background subtractionmodule 129. Where X and Y axes may be referred to herein, it is withreference to a two-dimensional (2D) plane cut through some point alongthe Z axis.

The computing device 101 may process the background subtraction modulewith reference to sequential sets of images from the video feedcontinually in real time. The post-processing module 131 may, forinstance, overlay the surviving FG regions onto a new background image,whether from a still or a video, to create a new image. Sequential,real-time processing may yield a series of such new images over the topof the new background to create a new video feed having the oldbackground replaced with the new background. The computer 101 may thendisplay the one or more subject in front of the new background on thedisplay screen 139 for viewing by the user.

During the process of processing sequential colored images from anincoming video feed, background history of the sequential colored imagesmay be kept up to date in the BGH storage 135. This history allowstracking the BG status of pixels in previous frames, e.g., whether thepixels were previously categorized as BG. This process and the way thebackground module incorporates BGH into a decision whether tocategorized UC regions as BG will be discussed in more detail below.

FIG. 2 is a block diagram including a flow chart showing the details ofsteps executed by the background subtraction module 129 of the system ofFIG. 1, to subtract a background from a video image. All or a subset ofthe steps may be executed for varying levels of robustness and qualityof a resulting FG image after subtraction of the background (BG). Thesteps need not be executed in a specific order unless specified. Sometechniques, such as interpolation, may be left out entirely, dependingon system requirements, capabilities, and desired quality. Each numberedblock or step in FIG. 2 will be explained in more detail later withreference to FIGS. 3-29.

At block 202, the system 100 may receive depth 123 and color 127information of a colored image and perform depth and IR thresholding,thus segmenting colored pixels and corresponding depth information ofthe images into three different regions including foreground (FG),background (BG), and unclear (UC). The result of the depth and IRthresholding of the image is a region map that shows the three regionspictorially. In block 204, the system 100 may identify and clean FG, BG,and UC three-dimensional connected components. At block 206, the system100 may enable a user 109 to select a user mode that depends on howclose a target subject is located with reference to the camera 103. Atblock 208, the system 100 may clean the UC region under a center of mass(COM) of the target subject. At block 210, the system 100 may warp theimage from a depth point of view to a color point of view, so that thedepth and color information are aligned in 3D-space. At block 212, thesystem 100 may receive RGB color information 127 and clean the remainingUC region with background history (BGH). At block 214, the system 100may interpolate the region map to categorize uncategorized pixels in theRGB image which have unknown depth value and unknown region value as FGor UC depending on region information of neighbor pixels. At block 216,the system 100 may dilate the UC region outward to surrounding pixelsthat are not in the FG region. At block 218, the system 100 may detect aFG fringe, which may include a thin area along the boundaries of the FGedges, e.g., those edges between the FG region and the UC region or theBG region. At block 220, the system 100 may update the BGH.

At block 222, the system 100 may clean the UC region using neighborpixels, which step focuses on cleaning along the colored edge of the FGregion. At block 224, the system 100 may clean the UC region under theCOM of the target subject. At block 226, the system 100 may apply amedian filter to the UC region to remove very small UC region, thenmerge the remaining UC regions into the FG regions. At block 228, thesystem 100 may stabilize and smooth the edges of the FG region(s). Atblock 230, the system 100 may check for reset conditions, and ifpresent, sets a reset flag. At block 234, the system 100 determines ifthe reset flag is true, and if so, resets the flag. At block 240, thesystem may reset both the BGH and a BG mask of the region map.Processing by the background subtraction module 121 of the system 100may then continue with another image from the video feed. Sequentialprocessing of colored images may lead to a continuous, real-time videofeed having the BG subtracted therefrom. At block 234, if the reset flaghas not been set, e.g., it has a false value, the system 100 continuesoperation at block 202 again to continue processing sequential images.The same is true after resetting the BG mask and BGH at block 240.

FIG. 3 is a screen shot of a system-captured video image showing inputdepth information of the video image. FIG. 4 is a screen shot of theinput infrared (IR) intensity of the video image captured in FIG. 3.FIG. 5 is a screen shot of the input red/green/blue (RGB) colorinformation of the video image captured in FIG. 3. FIG. 6 is a regionmap of the video image captured in FIG. 3, the regions displayedincluding unclear (UC) in light grey, foreground (FG) in dark grey, andbackground (BG) in black, which are generated in block 202 of FIG. 2. Inblock 202, the background subtraction module 131 may perform depth andIR thresholding, thus segmenting colored pixels and corresponding depthinformation of the images into three different regions includingforeground (FG), background (BG), and unclear (UC).

As discussed earlier, the “z” as used herein is with reference to adepth value of a particular pixel. A smaller value of z indicates that apixel is closer to the camera 103. The term “b” refers to brightness or,in other words, the IR intensity collected by the IR sensor. Withregards to a particular pixel, the higher the intensity (b) value is,the more confidently the system 100 can differentiate the real signalfrom ambient noise, and the more the system 100 can trust the depthvalue. Values segmented into a FG or BG region are done with highconfidence, whereas pixels initially segmented into the UC region arepixels with regards to which the system 100 is unsure how to categorize.Accordingly, if pixels of a colored image are not categorizable aseither FG or BG, the pixels may be categorized as UC. Note that pixelsin the same region do not need to be adjacent or near each other to becategorized, as displayed in FIG. 6.

One set of rules to drive this segmentation of the pixels of an image isfor the system 100 to: (1) categorize the pixel as foreground (FG) if adepth thereof is less than a predetermined threshold distance from thecamera and a intensity thereof is greater than a predetermined thresholdintensity; (2) categorize the pixel as unclear (UC) if a depth thereofis less than the predetermined threshold distance and an intensitythereof is less than the predetermined threshold strength; and (3)categorize all other pixels not categorized as FG or UC as background(BG). These rules are cast below in Equation 1, which depicts a regionmap, rmap[i].

$\left\{ {\begin{matrix}{{GF}\mspace{14mu}{if}\mspace{14mu}\left( {{{{0 < {z\lbrack i\rbrack} < z_{thresh}}\&}{b\lbrack i\rbrack}} > b_{thresh}} \right)} \\{{UC}\mspace{14mu}{if}\mspace{14mu}\left( {{{{0 < {z\lbrack i\rbrack} < z_{thresh}}\&}\mspace{14mu}{b\lbrack i\rbrack}} < b_{thresh}} \right)} \\{{BG}\mspace{14mu}{else}}\end{matrix}\quad} \right.$

FIG. 7 is a screen shot of the region map of FIG. 6 after execution ofblock 204 of FIG. 2 to detect and clean certain UC and FG 3D-connectedcomponents. The purpose of block 204 is to remove noisy parts, such asdots or blobs, or other meaningless fragments that may otherwise remainas FG. This helps to improve BGS quality as well as speeding up theimage processing.

The system 100, in executing block 204, begins by detecting and labelingpixels that are adjacent to each other, in the same region, and thathave similar depth values as region-specific connected components. Inother words, the depth values of two adjacent pixels in the samecomponent is smaller than a predetermined threshold. For instance, thesystem may detect and label FG-connected components in 3D space (XYplane plus depth, Z). The system 100 thus groups pixels that aredetermined to be connected components for common processing. In thefollow expressions, D is the depth image, p is a pixel, R is theregion-labeled map, N(p) are adjacent pixels around pixel p. A 3Dconnected-component label C_(k) εC is defined as C_(k)={pεD:∀p_(j)εN(p), R(p_(j))=R(p), ID (p_(j))−D(p) I<δ}. Let M be a connectedcomponent label map. For example M(p_(i)) may be equal to C_(k) where Cis a set of connected components and where C_(k) is a connectedcomponent (k) in that set.

Note that there may be many components in a region; however, every pixelin the same component includes the same region label. When a UCcomponent is referred to, reference is being made to a connectedcomponent in the UC region, for instance.

A meaningful component is a component whose area is larger than somethreshold value, γ. A large UC component, however, is most likely ameaningless component, for example, a part of a wall, a ceiling, or afloor. There are, however, some small-but-meaningful UC component suchas human hair, a belt, and a cell phone because these objects tend toabsorb infrared (IR) and are objects that should be kept for furtherprocessing. The trick is differentiating between meaningful UCcomponents with other noisy small UC components. In general, themeaningful UC components are going to be found adjacent to large,meaningful FG components. From these observations, the system 100 isprogrammed to delete components based on the following rules:

Rule 1: Categorize as BG any FG connected component having across-sectional area less than a predetermined threshold area, γ.

Rule 2: Categorize as BG any UC connected component having across-sectional area greater than γ′, where γ′ may be different than γ.

Rule 3: Categorize as BG any UC connected component having across-sectional area less than γ and for which no adjacent componentthereof includes a FG connected component having a cross-sectional areagreater than γ.

Note that categorizing FG or UC connected components as BG will have theresult of ultimately removing those components when the BG issubtracted.

In preparation for image processing under other blocks, the system may,at or near block 204, find the center of mass (COM) of large FGconnected components, such as a target subject, and compute the averagedepth value for each FG component. In other words, for a FG componentC_(i),

${{COM}_{x}(i)} = \frac{\sum_{p \in C_{i}}{x(p)}}{{area}\left( C_{i} \right)}$is the x coordinate of pixel p. From the same formula for COM_(y)(i),compute the average depth as:

$\begin{matrix}{d_{{avg}_{x}{(i)}} = \frac{\sum_{p \in C_{i}}{D(p)}}{{area}\left( C_{i} \right)}} & (2)\end{matrix}$

FIG. 8 is a screen shot of the region map of FIG. 7 showing center ofmass (COM) lines on a target subject that happens to be standing up. Asitting subject may be considered to be “near” the camera 103 and astanding subject may be considered to be “far” from the camera 103.Depth images usually suffer from different types of noise depending onthe distance between the subject and the camera 103. Furthermore, thesize of the body parts (in pixel units) such as hair, fingers, bodytorso, etc., and their IR intensity values depends on the camera-subjectdistance. In order to effectively clean up the edges of the subject,therefore, the system 100 uses two user modes in which the data areprocessed slightly different with different parameters. The modesinclude a Near Mode (typically for a subject sitting in a chair near thecamera 103) and Far Mode (typically for a subject standing up fartheraway from the camera 103). The system 100 decides between the two modesbased on the average depth of the largest FG connected components. It isreasonable to assume that the main subject is the main user 109 of thesystem 100.

FIG. 9 is a screen shot of the region map of FIG. 8 after execution ofblock 208 in FIG. 2 to clean the UC region under the COM. Again, herethe term “clean” indicates that those parts under the COM will becategorized as BG. The block 208 of FIG. 2 applies only in the NearMode. This is because, for the Far Mode, the subject is far away fromthe camera so it is more likely that some parts of the body of thesubject will be segmented into the UC region because the IR intensityvalues of those parts are not high enough. For example, objects andsurfaces that have weak IR reflectance include black textures on shirtsor jeans, a belt, and other absorbent surfaces or objects. If the system100 cleans these types of UC pixels too early in the backgroundsubtraction process, it would be very difficult to recover them later.

For each of the FG components, the system 100 categorizes all the UCpixels that lie under the COM as BG, thus cleaning those portions fromfurther processing within the UC region. The follow is example pseudocode for block 208:

For each pixel p ∈ D such that y(p)< COM_(y) //vertically under the COMpoint If (R(p) == UC) then R(p) = BG; // clean it = put it in BG regionEnd.

The purpose of block 208 is to help reduce errors caused by unexpectednoise around the user and reduce processing time. Simultaneously, thesystem 100 is still able to keep a hair part, for instance, in the UCregion for further processing in subsequent steps that the system 100may execute, which are shown in FIG. 2.

FIG. 10 is a diagram showing that a point X in the 3D space of acaptured video image can be warped from the reference image plane (depthsensor viewpoint) to the desired image plane (color sensor viewpoint) asexecuted in block 210 of FIG. 2. Warping the UC and FG region in thedepth image plane at depth view into the color image plane at a colorview shifts the depth information into color pixels at a differentlocation and resolution. Stated in another way, the system 100 maypropagate the depth information for the UC and FG regions from the depthsensor into the color sensor, to synchronize the depth information withcorresponding pixels in the color image when the color and depth sensorsare positioned at a different location in the 3D space.

More particularly, each point of an image in 2D space can be mapped oneto one with a ray in 3D space that goes through the camera position.Given a 2D image plane with basis vectors ({right arrow over (s)},{right arrow over (t)}) and a 3D space ({right arrow over (i)}, {rightarrow over (j)}, {right arrow over (k)}), the 2D point to 3D ray mappingrelation is:

$\begin{matrix}{r = {\begin{bmatrix}r_{i} \\r_{j} \\r_{k}\end{bmatrix} = {{\left\lbrack {{\overset{\rightarrow}{s}}_{ijk}{\overset{\rightarrow}{t}}_{ijk}{f \otimes {\overset{\rightarrow}{w}}_{ijk}}} \right\rbrack \cdot \begin{bmatrix}u \\v \\1\end{bmatrix}} = {P\begin{bmatrix}u \\v \\1\end{bmatrix}}}}} & (3)\end{matrix}$where (u, v) is the 2D coordinate of the point in the image plane; rrepresents the direction of the corresponding ray; {right arrow over(s)}_(ijk), {right arrow over (t)}_(ijk), and {right arrow over(w)}_(ijk) are representations of {right arrow over (t)} and viewingdirection {right arrow over (w)} in {{right arrow over (i)},{right arrowover (j)},{right arrow over (k)}}. Matrix P is called the mappingmatrix.

Consider a point X in 3D space {{right arrow over (i)},{right arrow over(j)},{right arrow over (k)}}. Let {right arrow over (x)}_(r), and x_(d)be homogeneous coordinates of X in the reference image plane and thedesired image plane as shown in FIG. 10. Let P_(n), and P_(d) be mappingmatrices of the reference camera and the desired camera. It has beenproven that the warping equation between {right arrow over (x)}_(r), and{right arrow over (x)}_(d) is:

$\begin{matrix}{{\overset{\rightarrow}{x}}_{d} = {P_{d}^{- 1}\left( {{\frac{{P_{r}{\overset{\rightarrow}{x}}_{r}}}{d\left( {\overset{\rightarrow}{x}}_{r} \right)}\left( {{\overset{\rightarrow}{C}}_{r} - {\overset{\rightarrow}{C}}_{d}} \right)} + {P_{r}{\overset{\rightarrow}{x}}_{r}}} \right)}} & (4)\end{matrix}$where d({right arrow over (x)}_(r)) is the depth value of point {rightarrow over (x)}_(r).

FIG. 11 is a screen shot of a warped FG region of a video image of asubject after execution of the warping in FIG. 10. FIG. 12 is a screenshot of a warped UC region corresponding to the video image of FIG. 11.

FIG. 13 is a screen shot of the UC region shown in FIG. 12 afterexecution of block 212 to FIG. 2 to clean the UC region with backgroundhistory (BGH) of corresponding UC region pixels.

The BGH is a frame that contains only background (BG) pixels. The frameis built in an accumulated fashion from the previous frame. At block 212of FIG. 2, for each UC pixel, if the BGH is available for the pixel, thesystem 100 compares the RGB value of the pixel with the correspondingone in the BGH. If the BGH of the pixel is unavailable for some reason,the system 100 searches for the BGH of a neighbor of the pixel andcompares the two. If they match, the system 100 sets the pixel to BG.Accordingly, one function for categorizing the UC pixels may be based oncolor dissimilarity between UC pixels and neighbor pixels of the coloredimage and based on color dissimilarity between the UC pixels andneighbor pixels of the BGH.

FIG. 14 is a screen shot of the FG region of the video imagecorresponding to FIGS. 11-13 after execution of block 214 to interpolatethe FG region. FIG. 15 is a screen shot of the UC region of the videoimage corresponding to FIGS. 11-13 after execution of block 214 tointerpolate the region map. After the warping step, the region map ofthe RGB frame contains lots of unknown values because of the up-samplingfrom Quarter Video Graphics Array (QVGA) to Video Graphics Array (VGA)resolution. Note that the resolution of the depth image is usually lowerthan that of the color image. For every pixel, the system 100 checks ifthe pixel is surrounded by other FG pixels within a predeterminedsupport window, e.g., within a window of a certain number of pixels inwidth by a certain number of pixels in height. If yes, the system 100sets the pixel to FG. Otherwise, the system 100 checks to see whetherthe pixel is surrounded by other UC pixels. If the pixel is surroundedby other UC pixel, the system 100 categorizes the pixel as UC.

FIG. 16 is a screen shot of the UC region of the video image in FIG. 15after execution of block 216 of FIG. 2 to dilate the remaining UCregion. The purpose of the dilation of the current UC region is toensure that subtle areas in the edges of a target subject such as a hairpart or earrings are well covered by the UC region. To execute block216, the system 100 may dilate the current UC region outward tosurrounding pixels that are not in the FG region.

Dilation is one of the two basic operators in the area of mathematicalmorphology, the other being erosion. It is typically applied to binaryimages, but there are versions that work on grayscale images. The basiceffect of the mathematical morphology operator on a binary image is togradually enlarge the boundaries of regions of foreground pixels (i.e.white pixels, typically). Thus areas of foreground pixels grow in sizewhile holes within those regions become smaller.

FIG. 17 is a screen shot of the UC region of FIG. 16 after execution ofblock 218 in FIG. 2 to detect a FG fringe and merge it into the currentUC region. At block 218, the system 100 may use the morphologicalopening operator to detect a FG fringe and merge it into the current UCregion.

The purpose of detecting the FG fringe and merging it into the UC regionis as follows. Due to the tolerance in registration (or warping betweenthe depth information and color image), depth resolution, interpolationand flickering artifacts, the region map edges shown in FIG. 16 may notbe good cutting edges. In fact, there is usually a small mismatchbetween region map edges and the RGB edges, assuming the RGB edges lieclose to the region map edges. With the above opening operator, thesystem 100 can narrow down the area along the edge to perform furtherprocessing to get a FG-BG cut at the RGB edges. This helps significantlyreduce processing time.

FIG. 18 is a screen shot of the BG region of the video image of FIG. 17after execution of block 220 to update the BGH based on the BG regionand any unknown pixels. The system 100 may update the BGH based on allBG and unknown pixels. For each BG and unknown pixel I, if its BGHI_(BG) exists, then the system 100 may set I_(BG) ^((t))=0.75I_(BG)^((t-1))+0.25I^((t)), else I_(BG) ^((t))=I^((t)) if no BGH exists. Inthe above formula, superscript (I) is the frame index, such that (t−1)indicates the immediate previous history of current frame, t.

FIG. 19 is a screen shot of the UC region of the video image of FIG. 18before execution of block 222 of FIG. 2 to clean the UC region usingneighbor pixels. FIG. 20 is a screen shot of the UC region of the videoimage of FIG. 19 after execution of block 222 of FIG. 2 to clean the UCregion using neighbor pixels. To execute block 222, the system 100 maycompare each UC pixel in the current region map with its neighbors thatare not in the UC region. The system 100 may then set the UC regionpixels the same as the region of the neighbor that best matches.

FIG. 21 is a screen shot of the UC region of the video image of FIG. 20after execution of block 224 to clean the UC region under the COM of thesubject. This step applies for both Near and Far modes. For each FGcomponents, the system 100 may clean, and thus categorize as BG, all UCpixels that lie under the center of mass (COM) point of one or moretarget subjects, to execute block 224.

Block 224 repeats this cleaning step because the system 100 expanded theUC region around the region map edges at block 216, and after block 222,there may still exist some unresolved UC pixels. Because, after the nextstep, the UC pixels are set to FG (to recover the top part of the hair),so block 224 helps reduce errors caused by unexpected noisy edges aroundthe user without affecting the hair part (or other reflectance-sensitivearea).

FIG. 22 is a screen shot of the FG region of the video image of FIG. 21before execution of block 226 of FIG. 2 to apply a median filter to theUC region and merge the remaining UC region with the FG region. FIG. 23is a screen shot of the FG region of the video image of FIG. 21 afterexecution of block 226 of FIG. 2 to apply the median filter to the UCregion and merge the remaining UC region with the FG region. The screenshot of FIG. 23 also shows the image before execution of block 228.

To execute block 226, the system 100 may remove very small remaining UCconnected components, also referred to as fragments, but keep andsmoothen the edges of big UC connected components such as part or all ofthe hair of a target subject. A 7×7 support window may be applied by themedian filter to the UC connected components, for instance, or anothersuitably-sized window may be applied. Then the UC region may be mergedwith the FG region. Pseudo code to be executed by the system 100 atblock 226 may include:

For each pixel p in UC region { Count = O; For each pixel p_(i) in theNxN support window around pixel p { If R(p_(i)) = UC, count++; } If(count<N*N/2), R(p) = BG; Else R(p) = FG; }.

FIG. 24 is a screen shot of the region map of the video image of FIG. 23after execution of block 228 to stabilize and smooth FG images byreducing flickering and blurring. The resultant target FGimage(s)/region(s), with the BG subtracted, is/are displayed in thedisplay device 139. To execute block 228, the system 100 may compare thecurrent frames with the region map of the last frame to reduce theflickering around the FG edges. For each UC region pixel before block224, the system 100 may limit the search area to speed up processing,and if the color of a frame is unchanged from a previous frame, thesystem 100 may copy the region map value from the previous frame intothe current frame. The system 100 may then apply a 5×5 median filter,for instance, and/or spatial filters on the FG pixels to smoothen edges.

FIG. 25 is a screen shot of an example video image before execution ofthe background subtraction module of FIG. 2. FIG. 26 is a screen shot ofthe video image of FIG. 28 after execution of the background subtractionmodule of FIG. 2. FIG. 27 is a screen shot of another example videoimage before execution of the background subtraction module of FIG. 2.FIG. 28 is a screen shot of the video image of FIG. 27 after executionof the background subtraction module of FIG. 2.

At block 230 of FIG. 2, the system 100 may detect reset conditions,which is a block available to the system 100 throughout the backgroundsubtraction process. If a reset condition is detected, a reset flat isset to true. A reset condition may include, but not be limited to thefollowing examples. (1) The system 100 may receive an indication thatthe camera is shaken, which makes the background history (BGH) useless.(2) The target subject may be too close to the camera 103, which causesa large IR saturation area, resulting in a large unknown or backgroundarea, wherein the system 100 may mistakenly update the BGH. (3) The usermay move from the BG to the FG. When the target subject was in thebackground (BG), the BGH of corresponding pixels was updated. When thetarget subject moves into the FG of the scene, the BGH behind the targetsubject is no longer correct and needs to be reset. (4) The system 100may detect a significant lighting change, which also makes the BGHuseless. At block 234 of FIG. 2, the system 100 may detect whether thereset flag has been set. If it has, the system 100 resets the background(BG) mask and the BGH at block 240.

FIG. 29 illustrates a general computer system 2900, which may representthe computing device 101 or any computer or computing devices referencedherein. The computer system 2900 may include an ordered listing of a setof instructions 2902 that may be executed to cause the computer system2900 to perform any one or more of the methods or computer-basedfunctions disclosed herein. The computer system 2900 may operate as astand-alone device or may be connected, e.g., using the network 116, toother computer systems or peripheral devices.

In a networked deployment, the computer system 2900 may operate in thecapacity of a server or as a client-user computer in a server-clientuser network environment, or as a peer computer system in a peer-to-peer(or distributed) network environment. The computer system 2900 may alsobe implemented as or incorporated into various devices, such as apersonal computer or a mobile computing device capable of executing aset of instructions 2902 that specify actions to be taken by thatmachine, including and not limited to, accessing the Internet or Webthrough any form of browser. Further, each of the systems described mayinclude any collection of sub-systems that individually or jointlyexecute a set, or multiple sets, of instructions to perform one or morecomputer functions.

The computer system 2900 may include a processor 2904, such as a centralprocessing unit (CPU) and/or a graphics processing unit (GPU). TheProcessor 2904 may include one or more general processors, digitalsignal processors, application specific integrated circuits, fieldprogrammable gate arrays, digital circuits, optical circuits, analogcircuits, combinations thereof, or other now known or later-developeddevices for analyzing and processing data. The processor 2904 mayimplement the set of instructions 2902 or other software program, suchas manually-programmed or computer-generated code for implementinglogical functions. The logical function or any system element describedmay, among other functions, process and/or convert an analog data sourcesuch as an analog electrical, audio, or video signal, or a combinationthereof, to a digital data source for audio-visual purposes or otherdigital processing purposes such as for compatibility for computerprocessing.

The computer system 2900 may include a memory 2908 on a bus 2912 forcommunicating information. Code operable to cause the computer system toperform any of the acts or operations described herein may be stored inthe memory 2908. The memory 2908 may be a random-access memory,read-only memory, programmable memory, hard disk drive or any other typeof volatile or non-volatile memory or storage device.

The computer system 2900 may also include a disk or optical drive unit2914. The disk drive unit 2914 may include a computer-readable medium2918 in which one or more sets of instructions 2902, e.g., software, canbe embedded. Further, the instructions 2902 may perform one or more ofthe operations as described herein. The instructions 2902 may residecompletely, or at least partially, within the memory 3208 and/or withinthe processor 2904 during execution by the computer system 2900.Accordingly, the BGH database described above in FIG. 1 may be stored inthe memory 2908 and/or the disk unit 2914.

The memory 2908 and the processor 2904 also may includecomputer-readable media as discussed above. A “computer-readablemedium,” “computer-readable storage medium,” “machine readable medium,”“propagated-signal medium,” and/or “signal-bearing medium” may includeany device that includes, stores, communicates, propagates, ortransports software for use by or in connection with an instructionexecutable system, apparatus, or device. The machine-readable medium mayselectively be, but not limited to, an electronic, magnetic, optical,electromagnetic, infrared, or semiconductor system, apparatus, device,or propagation medium.

Additionally, the computer system 2900 may include an input device 2924,such as a keyboard or mouse, configured for a user to interact with anyof the components of system 2900. It may further include a display 2929,such as a liquid crystal display (LCD), a cathode ray tube (CRT), or anyother display suitable for conveying information. The display 2929 mayact as an interface for the user to see the functioning of the processor2904, or specifically as an interface with the software stored in thememory 2908 or the drive unit 2914.

The computer system 2900 may include a communication interface 2936 thatenables communications via the communications network 116. The network116 may include wired networks, wireless networks, or combinationsthereof. The communication interface 2936 network may enablecommunications via any number of communication standards, such as802.11, 802.17, 802.20, WiMax, cellular telephone standards, or othercommunication standards.

Accordingly, the method and system may be realized in hardware,software, or a combination of hardware and software. The method andsystem may be realized in a centralized fashion in at least one computersystem or in a distributed fashion where different elements are spreadacross several interconnected computer systems. Any kind of computersystem or other apparatus adapted for carrying out the methods describedherein is suited. A typical combination of: hardware and software may bea general-purpose computer system with a computer program that, whenbeing loaded and executed, controls the computer system such that itcarries out the methods described herein. Such a programmed computer maybe considered a special-purpose computer.

The method and system may also be embedded in a computer programproduct, which includes all the features enabling the implantation ofthe operations described herein and which, when loaded in a computersystem, is able to carry out these operations. Computer program in thepresent context means any expression, in any language, code or notation,of a set of instructions intended to cause a system having aninformation processing capability to perform a particular function,either directly or after either or both of the following: a) conversionto another language, code or notation; b) reproduction in a differentmaterial form.

The above-disclosed subject matter is to be considered illustrative, andnot restrictive, and the appended claims are intended to cover all suchmodifications, enhancements, and other embodiments, which fall withinthe true spirit and scope of the present disclosure. Thus, to themaximum extent allowed by law, the scope of the present embodiments areto be determined by the broadest permissible interpretation of thefollowing claims and their equivalents, and shall not be restricted orlimited by the foregoing detailed description. While various embodimentshave been described, it will be apparent to those of ordinary skill inthe art that many more embodiments and implementations are possiblewithin the scope of the above detailed description. Accordingly, theembodiments are not to be restricted except in light of the attachedclaims and their equivalents.

The invention claimed is:
 1. A method comprising: receiving a video feedat a computing device having a processor and memory, the video feedcomprising at least one color image including depth information of oneor more subjects; categorizing pixels of the at least one color imagehaving a depth thereof less than a predetermined threshold distance aseither foreground (FG) or unclear (UC); recategorizing UC pixels as FGor to remove categorization using a function that considers at least oneof (i) color and background history (BGH) information associated withthe UC pixels and (ii) color and BGH information associated with pixelsnear the UC pixels; and constructing at least one new color image byextracting the FG pixels of the at least one color image.
 2. The methodof claim 1, wherein the function for recategorizing the UC pixels isbased on at least one of (i) color dissimilarity between the UC pixelsand pixels near the UC pixels of the at least one colored image and (ii)color dissimilarity between the UC pixels and pixels near the UC pixelsof the BGH information.
 3. The method of claim 1, further comprisingapplying at least one of (i) spatial smoothing to a FG boundary byutilizing a median filter and (ii) temporal filtering by inspectingcolor images and FG assignment of a current and at least one previousframe.
 4. The method of claim 1, wherein constructing the at least onenew color image further comprises overlaying the FG pixels on at leastone image from a second video.
 5. The method of claim 1, wherein thecategorizing step comprises, for each of a plurality of pixels atvarying depths along a Z axis of the image: categorizing the pixel as FGif a depth thereof is less than a predetermined threshold distance fromthe camera and an intensity thereof is greater than a predeterminedthreshold intensity; and categorizing the pixel as UC if a depth thereofis less than the predetermined threshold distance and an intensitythereof is less than the predetermined threshold intensity.
 6. Themethod of claim 1, further comprising: detecting and labeling asconnected components pixels that are adjacent to each other, are in thesame categorization, and have depth values smaller than a predeterminedthreshold, wherein recategorizing the UC pixels comprises: removing thecategorization of any FG connected component having a cross-sectionalarea less than a predetermined threshold area, γ; removing thecategorization of any UC connected component having a cross-sectionalarea greater than a second predetermined threshold area, γ′; andremoving the categorization of any UC connected component having across-sectional area less than γ and for which no adjacent componentthereof includes a FG connected component having a cross-sectional areagreater than γ.
 7. The method of claim 6, further comprising: detectinga FG fringe of FG pixels along at least one boundary using amorphological opening operator applied thereto; merging the FG fringeinto a UC region of remaining UC pixels; comparing each of a pluralityof pixels in the UC region with corresponding neighbor pixels that arenot assigned as UC pixels; recategorizing each compared pixel in the UCregion to FG or to remove categorization based on the neighbor pixelsthat best match the compared pixel; and merging any remaining UC regionwith the FG regions.
 8. The method of claim 7, further comprising:removing categorization of UC pixels that lie under a center of mass ofeach FG component; and removing categorization of smallest UC connectedcomponents based on a median filter applied to the remaining UC pixelsin the UC region.
 9. The method of claim 7, further comprising, beforedetecting and merging the FG fringe into the UC region: warping the FGand UC regions from a depth sensor viewpoint to a color sensorviewpoint; comparing RGB values of the UC pixels with corresponding BGHinformation, and where a match is found, recategorizing the UC pixel toremove categorization; and dilating any remaining UC pixels tosurrounding pixels thereof that are not categorized as FG pixels. 10.The method of claim 9, further comprising: propagating the depthinformation for the UC region and for the FG connected components from adepth sensor into a color sensor, to synchronize the depth informationwith corresponding pixels in the at least one color image when the colorand depth sensors are respectively positioned at different locations in3D space; and for each of a plurality of the pixels having unknown RGBvalues: determining if the pixel is surrounded by other FG or UC pixelswithin a predetermined support window; recategorizing the unknown pixelsthat are surrounded by FG pixels as FG; and recategorizing the unknownpixels that are surrounded by UC pixels as UC.
 11. The method of claim9, further comprising: computing an average depth value for each FGconnected component; and selecting between a near mode and a far modebased on the average depth of the largest FG connected component, wherethe near mode is selected if the average depth is less than apredetermined threshold depth.
 12. The method of claim 11, furthercomprising, when in near mode, for each FG connected component,categorizing to remove categorization a plurality of UC pixels that lieunder a corresponding center of mass of corresponding one or more FGconnected components before comparison thereof with the BGH information.13. The method of claim 9, further comprising resetting the BGHinformation in response to detecting at least one of: an indication thatthe camera is shaken; one or more subjects being too close to thecamera; a subject from the background moving into the foreground; and asignificant lighting change.
 14. The method of claim 6, furthercomprising: determining if a red/blue/green (RGB) value of each of aplurality of UC pixels is unchanged from a previous frame; copying onlythose UC pixels with RGB values that are unchanged into an updated UCregion; and applying a median filter on the FG pixels to smoothboundaries of the FG connected components.
 15. A system comprising acomputing device having a processor and memory, the processor programmedto receive video data, via a 3D application programming interface (API),from a camera, the video data containing (i) at least one colored imageof one or more subjects and (ii) corresponding depth information; theprocessor further programmed to: receive video data comprising at leastone color image including depth information of one or more subjects;categorize pixels of the at least one color image having a depth thereofless than a predetermined threshold distance as either foreground (FG)or unclear (UC); recategorize UC pixels to FG or to removecategorization using a function that considers at least one of (i) colorand background history (BGH) information associated with the UC pixelsand (ii) color and BGH information associated with pixels near the UCpixels; and construct at least one new color image by extracting the FGpixels of the at least one color image.
 16. The system of claim 15,wherein the processor is further programmed such that the function forrecategorizing the UC pixels is based on at least one of (i) colordissimilarity between UC pixels and pixels near the UC pixels of the atleast one colored image and (ii) color dissimilarity between the UCpixels and pixels near the UC pixels of the BGH information.
 17. Thesystem of claim 15, wherein the processor is further programmed to applyat least one of (i) spatial smoothing to a FG boundary by utilizing amedian filter and (ii) temporal filtering by inspecting color images andFG assignment of a current and at least one previous frame.
 18. Thesystem of claim 15, wherein the processor is further programmed suchthat constructing the at least one new color image further comprisesoverlaying the FG pixels on at least one image from a second video. 19.The system of claim 15, wherein the processor is further programmed suchthat categorizing pixels of the video data further comprises, for eachof a plurality of pixels at varying depths along a Z axis of the image:categorizing the pixel as FG if a depth thereof is less than apredetermined threshold distance from the camera and an intensitythereof is greater than a predetermined threshold intensity; andcategorizing the pixel as UC if a depth thereof is less than thepredetermined threshold distance and an intensity thereof is less thanthe predetermined threshold intensity.
 20. The system of claim 15,wherein the processor is further programmed to: detect and label asconnected components pixels that are adjacent to each other, are in thesame categorization, and have depth values smaller than a predeterminedthreshold, wherein recategorizing the UC pixels further comprises:removing the categorization of any FG connected component having across-sectional area less than a predetermined threshold area, γ;removing the categorization of any UC connected component having across-sectional area greater than a second predetermined threshold area,γ′; and removing the categorization of any UC connected component havinga cross-sectional area less than γ and for which no adjacent componentthereof includes a FG connected component having a cross-sectional areagreater than γ.